﻿using GFE.Interfaces.Sample.Consts;
using GFE.Interfaces.Sample.Factories;
using GFE.Interfaces.Sample.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;

namespace GFE.Customers.Sample.Factories
{
    [ExportAttribute(typeof(ICustomerModelFactory))]
    public class CustomerModelFactory : ICustomerModelFactory
    {
        public CustomerModel CreateEmpty(CustomerModel model)
        {
            return model;
        }

        public CustomerModel CreateFromDataRow(System.Data.DataRow dataRow, CustomerModel model)
        {
            model.Name = dataRow[ColumnConsts.CustomerListColumn_Name] + string.Empty; // + string.Empty is a Peter Anker trick for always getting as string.. 
            model.Address = dataRow[ColumnConsts.CustomerListColumn_Address] + string.Empty; // + string.Empty is a Peter Anker trick for always getting as string.. 
            return model;
        }

        public CustomerModel CreateFromListItem(Microsoft.SharePoint.SPListItem listItem, CustomerModel model)
        {
            model.Name = listItem[ColumnConsts.CustomerListColumn_Name] + string.Empty; // + string.Empty is a Peter Anker trick for always getting as string.. 
            model.Address = listItem[ColumnConsts.CustomerListColumn_Address] + string.Empty; // + string.Empty is a Peter Anker trick for always getting as string.. 
            return model;
        }

        public string CreateViewFields()
        {
            throw new NotImplementedException();
        }

        public void CreateSPListItem(CustomerModel model, ref Microsoft.SharePoint.SPListItem listItem)
        {
            throw new NotImplementedException();
        }

        public CustomerModel CreateFromXelement(System.Xml.Linq.XElement element, CustomerModel model)
        {
            throw new NotImplementedException();
        }
    }
}
